home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2002 March
/
PCWMAR02.iso
/
software
/
turbocad
/
V4
/
tcw.z
/
drawing name.bas
< prev
next >
Wrap
BASIC Source File
|
1997-10-28
|
2KB
|
91 lines
'Program to loop through open drawings and add drawing name
Dim x As Double
Dim y As Double
Dim angle As Double
Dim siz As Double
Dim es As Double
Dim es1 As Long
Dim dName as String
Dim Dname1 As String
Dim measure As double
Sub Main()
Dim dCount as Long
Dim hDrawing as Long
Dim i As Long
'Get count of number of drawings open
dCount = TCWDrawingCount()
If (dCount = 0) Then
MsgBox "No drawings open"
Stop
End If
'Loop through open drawings
For i = 0 to dCount -1
'activate drawing "i"
hDrawing = TCWDrawingAt(i)
measure = Abs(TCWViewExtentsGetY2() - TCWViewExtentsGetY1())/8.6
'Get drawing name
TCWDrawingName dName
es1=20*measure
es=es1/100
'Prompt for location and angle of text
MyDialog
'Calculate angle in radians for text
angle = angle * 3.14159265359
angle = angle / 180
'Write the name on the drawing
TCWText x, y, 0.0, dName1, siz, angle
Next i
MsgBox "Finished"
End Sub
Sub MyDialog()
Begin Dialog MyUI 60, 60, 240, 105, "Add Drawing Name"
Text 10, 11, 60, 10, "Drawing Name:"
TextBox 65, 10, 165, 10, .Dnm
Text 10, 21, 110, 10, "X Coordinate for name:"
TextBox 110, 20, 40, 10, .x
Text 10, 31, 110, 10, "Y Coordinate for name:"
TextBox 110, 30, 40, 10, .y
Text 10, 41, 110, 10, "Size to print text (in):"
TextBox 110, 40, 40, 10, .sizeT
Text 10, 51, 110, 10, "Angle to print text (in degrees):"
TextBox 110, 50, 40, 10, .angle
OKbutton 80, 80, 40, 12
CancelButton 120, 80, 40, 12
End Dialog
Dim Dlg1 As MyUI
Dlg1.x = es
Dlg1.y = es
Dlg1.angle = 90.0
Dlg1.sizeT=es
Dlg1.Dnm=dName
button = Dialog(Dlg1)
if button = 0 then
Stop
end If
siz=Dlg1.sizeT
x = Dlg1.x
y = Dlg1.y
angle = Dlg1.angle
dName1= Dlg1.Dnm
End Sub